import ACT from '../pages/actionType'
import { connect } from 'react-redux'

/**
 * 获取登录者信息
 * @return {{types: *[], promise: (function(): AxiosPromise<any>)}}
 */
export function getUser() {
  return {
    types: [ACT.COMMON_USER_GET],
    promise: ajax => ajax.get('/common/getUser', {})
  }
}

/**
 * 取出数据和绑定方法
 */
export const commonUser = connect(
  //取出数据
  state => ({
    commonUser: state.Common.commonUser
  })
)
